package com.zzh.wsss.controller;

import com.zzh.wsss.pojo.Apply;
import com.zzh.wsss.pojo.Job;
import com.zzh.wsss.service.UserPunchClockService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

@RestController
@CrossOrigin
public class UserPunchClockController {

    @Autowired
    private UserPunchClockService userPunchClockService;

    @RequestMapping(value = "/punchClock",method = RequestMethod.POST)
    private Map<String,Object> userPunchClock(@RequestBody Map<String,String> map){
        String username=map.get("username");
        Map<String,Object> m=userPunchClockService.punchClock(username);
        return m;
    }

    @RequestMapping(value = "/getPunchClock",method = RequestMethod.GET)
    private Map<String,Object> userPunchClock(String username){
        Boolean state=userPunchClockService.punchClockState(username);
        Map<String,Object> map=new HashMap<String, Object>();
        map.put("state",state);
        return map;
    }

    @RequestMapping(value = "/getUserPunchClockInfo",method = RequestMethod.GET)
    private Map<String,Object> getUserPunchClockInfo(String username){
        Map<String,Object> map=userPunchClockService.getUserPunchClockInfo(username);
        return map;
    }

}
